This invention relates to a disk drive and, more particularly, to an intelligent hard disk drive with a cache memory and a method and apparatus to control the cache memory and the transfer of data in and out of the cache memory.
An intelligent hard disk drive employs a buffer memory, known as a cache or a cache memory, to buffer data transferred to and from a host computer. The cache may be divided into multiple segments. The disk drive communicates with the host via a host interface. The host interface in some instances may process commands and data associated with those commands independently. One such intelligent interface is the small computer system interface (SCSI).
In SCSI the host computer is known as the initiator and the disk drive is known as the target. The initiator sends a command to the target and the target must determine what appropriate action to take based on the type of command. SCSI commands are communicated by sending a command descriptor block during a command phase. SCSI supports a number of commands including a read command and read extended command, a write command and a write extended command. One of the SCSI commands, the format unit command descriptor block, formats the drive medium into initiator addressable logical blocks. Each logical block has a logical block address (lba). SCSI also includes a caching page that can define parameters associated with the drive's cache.
A read command requests that the drive transfer data to the initiator. The most recent data written in the logical block address is returned. The logical block address specifies the address where the read operation is to begin. A transfer length specifies the number of contiguous logical blocks of data to be transferred to the initiator.
A read extended command also requests that the drive transfer the data to the initiator. The most recent data value written in the logical block address is returned. In the read extended command, a disable page out DPO value indicates that the drive assigns the data returned by this command the lowest priority for cache retention. A force unit access FUA value indicates that the drive accesses the media prior to returning GOOD status. Data is accessed from the media not the cache. As in the read command, the logical block address specifies where the read operation is to begin and the transfer length specifies the number of contiguous logical blocks of data to be transferred to the initiator.
A seek command requests the drive to seek to a specified logical block address. The logical block address specifies the address where the drive seeks to.
A write command requests that the drive write data transferred from the initiator to the drive media. A logical block address specifies the address where the write operation is to begin and the transfer length specifies the number of contiguous logical blocks of data to be transferred from the initiator.
A write extended command requests that the drive write data transferred from the initiator to the media. A disable page out DPO value indicates that the drive assigns the data transfer by the initiator the lowest priority for cache retention. A force unit access FUA value indicates that the drive writes the data to the media prior to returning a GOOD status. Data is written to the media and is not write cached. The logical block address specifies where the write operation is to begin.
The disk drive responds to these and other types of commands as multiple commands are received from the host computer. The way in which the disk drive manages multiple commands and the data associated with these commands directly affects the performance of the disk drive. Also certain features of the disk drive, including the way data is stored on the media and the nature of media access, afford an opportunity to increase drive performance.